package apiday02.homework;

import java.util.ArrayList;
import java.util.Collection;
import java.util.Iterator;

public class NewForDemo {
    public static void main(String[] args) {
        String[] array = {"one","two","three","four","five"};
        for (int i = 0; i < array.length; i++) {
            System.out.print(array[i]+" ");
        }
        System.out.println();
        for (String str:array) {
            System.out.print(str+" ");
        }
        System.out.println();

        Collection<String> c = new ArrayList<>();
        c.add("jack");
        c.add("tom");
        c.add("miss");
        c.add("baby");
        c.add("good");
        Iterator it = c.iterator();
        while (it.hasNext()){
            System.out.print(it.next()+" ");
        }
        System.out.println();
        for (String str: c) {
            System.out.print(str+" ");
        }


    }
}
